package chapter3.No3_3_类ThreadLocal的使用.demo3;

/**
 * *：解决get()不返回null
 *
 *   办法：重写ThreadLocal的initialValue方法
 * Created by Administrator on 2016/11/20.
 */
public class Main {
    static MyThreadLocal myThreadLocal = new MyThreadLocal();

    public static void main(String[] args) {
        if (myThreadLocal.get() == null) {
            System.out.println("我的值为Null");
            myThreadLocal.set("我有值了");
        }
        System.out.println(myThreadLocal.get());
        System.out.println(myThreadLocal.get());

    }
}
